<template>
  <div>
    <div class="personal-outer">
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span>个人信息</span>
        </div>
        <div>
          <div class="item">
            <el-image
              style="width: 100px; height: 100px"
              :src="url"
              :fit="fit"></el-image>
          </div>
          <div class="item">
            <div class="item-in">
              <span>电话号码:</span>
              <span>{{ user.userMobile }}</span>
            </div>
            <div class="item-in">
              <span @click="goToAuthentication">{{ user.isAuthentication == '0'?'未认证':'已认证' }}</span>
            </div>
          </div>
        </div>
      </el-card>
      <el-card class="personal-content" shadow="hover">
        <div class="item-outer">
          <div class="item">
            <p>银行卡</p>
            <p>{{ 0 }}</p>
          </div>
          <div class="item">
            <p>优惠价</p>
            <p>{{ 0 }}</p>
          </div>
          <div class="item">
            <p>会员积分</p>
            <p>{{ 0 }}</p>
          </div>
        </div>
      </el-card>
      <el-card class="credit-evaluation" shadow="hover">
        <div slot="header" >
          <span>信用评估</span>
        </div>
        <div>您的综合信用评估为: 822</div>
      </el-card>
      <el-card class="assets" shadow="hover">
        <div slot="header"><span>我的资产</span></div>
        <div class="item-outer">
          <div class="item">
            <p style="font: 25px bold">余额</p>
            <p style="font: 25px bold">{{ user.balance }}</p>
            <p style="color: #8b8b8b">昨日收益 90.61</p>
          </div>
          <div class="item">
            <p style="font: 25px bold">待还</p>
            <p style="font: 25px bold">1002</p>
            <p style="color: #8b8b8b">下期待还金额221.00</p>
          </div>
        </div>
      </el-card>
      <el-card shadow="hover">
        <div slot="header"><span>借贷</span></div>
        <div class="item-outer">
          <div class="item">借款记录</div>
          <div class="item">还款记录</div>
        </div>
      </el-card>
      <el-card shadow="hover">
        <div class="flot-outer">
          <div>理财</div>
          <div style="color: #8b8b8b">收益情况</div>
        </div>
      </el-card>
      <el-card shadow="hover">
        <div class="flot-outer">
          <div>保险</div>
          <div style="color: #8b8b8b">1份保单</div>
        </div>
      </el-card>

    </div>
  </div>
</template>

<script>
import user from '../../api/personal/user'
export default {
  name: 'index',
  data() {
    return {
      url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
      user:{},
      authenticationStatus:'',
    }
  },
  created() {
    user.queryUserByMobile(this.$store.state.member.mobile).then(response=>{
      this.user=response.data
    })
    user.InferAuthentication(this.$store.state.member.mobile).then(res=>{
      this.authenticationStatus=res.data;
    })
  },
  methods: {
    goToAuthentication(){
      if (this.authenticationStatus=="0"){
        this.$router.push({path:"/jr/personal/authentication"})
      }else if (this.authenticationStatus=="1"){
        this.$message.success("正在审核中,请耐心等待!");
      }else if (this.authenticationStatus=="2"){
        this.$message.success("审核失败,请重新");
        this.$router.push({path:"/jr/personal/authentication"});
      }else {
        this.$message.success("已审核");
      }

    }
  }
}
</script>

<style scoped>
  .personal-outer{
    margin: 20px 100px 100px;
  }
  .personal-outer>div{
    margin-top: 20px;
  }
  .box-card .item{
    margin-right: 50px;
    float: left;
    margin-bottom: 20px;
  }
  .box-card .item .item-in{
    height: 30px;
    width: 200px;
    margin-top: 15px;
    margin-bottom: 15px;
  }
  .item-outer{
    display: flex;
    justify-content: space-around;
  }
  .personal-content .item{
    height: 80px;
    width: 150px;
    text-align: center;
  }
  .flot-outer>div{
    height: 80px;
    width: 100px;
    text-align: center;
    line-height: 80px;
  }
  .flot-outer>div:first-child{

    float: left;
  }
  .flot-outer>div:last-child{
    float: right;
  }


</style>
